package com.patzn.osgi.listener;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

/**
 * @name: BundleListenerActivator
 * @description: BundleListenerActivator
 * @author: jiangcs
 */
public class BundleListenerActivator implements BundleActivator {
    @Override
    public void start(BundleContext bundleContext) throws Exception {
        bundleContext.addBundleListener(bundleEvent -> System.out.println(bundleEvent.getBundle().getSymbolicName() + "start:" + bundleEvent.getType()));
    }

    @Override
    public void stop(BundleContext bundleContext) throws Exception {
        bundleContext.addBundleListener(bundleEvent -> System.out.println(bundleEvent.getBundle().getSymbolicName() + " stop:" + bundleEvent.getType()));
    }
}
